package com.lanou3g.hw0412;

import java.util.Scanner;

/**
 * Created by dllo on 18/4/10.
 */
/*
 完成 计算器 v1.0
 1.可以计算 两位整数的 + -  * /
 2.使用流程:
   2.1 先输入1 个数,再 输入1个数
   2.2 然后输入操作符(+ _ * /)
   2.3 打印出结果
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个数");
        int a = scanner.nextInt();
        System.out.println("请输入第二个数");
        int b = scanner.nextInt();
        System.out.println("请输入操作符");
        String op = scanner.next();

        Operator operator
                = OperatorFactory.getOperator(op);
        if (operator == null) {
            System.out.println("操作符:" + op + "还不支持");
        } else {
            Number result = operator.compute(a, b);

            System.out.println("结果是:" + result);

        }

    }
}